<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%-- <link rel="stylesheet"
	href="<%=request.getContextPath() %>/WEB-ROOT/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="<%=request.getContextPath() %>/WEB-ROOT/css/common.css">
<link rel="stylesheet"
	href="<%=request.getContextPath() %>/WEB-ROOT/bootstrap/css/treeview.css"> --%>


<%
    HttpSession s = request.getSession();
%>
<body class="full" id="content">
<div id="alert"></div>
<div id="addTrainList"></div>
<div class="row">


        </form>
        <form class="form-inline" role="form"></form>

        <div class="table-responsive " style="margin-left: 3%;">

            <table class="table table-hover tablefont">
                <tbody id="tableList">

                </tbody>

            </table>
            <div style="bottom: 10%">
                <div id="paging" style="text-align: center; margin-left: 25%;">
                </div>

            </div>


        </div>

    </div>
</div>

<%-- <script
    src="<%=request.getContextPath() %>/WEB-ROOT/bootstrap/js/jquery-min.js"></script>
<script
    src="<%=request.getContextPath() %>/WEB-ROOT/bootstrap/js/treeview.js"></script>
<script
    src="<%=request.getContextPath() %>/WEB-ROOT/bootstrap/js/bootstrap.min.js"></script> --%>

<script type="text/javascript">
    //增加
    var authority = "${authority}";
    //增加
    $("#addTrain").click(function(){
        $("#addTrainList").load("WEB-ROOT/html/Attendance/addAttendance.jsp",function(){
            $("#addModel").modal({
                keyboard: true
            });

        })

    });
    var pageSize = 8;
    var dataUrl = "${pageContext.request.contextPath}/attendanceSub";
    selectList= function(){
        initPage("0",pageSize,dataUrl);
    };
    initPage("0", pageSize, dataUrl);


    function initPage(num, ps, url) {
        //alert(num);
        $.ajax({
            url : url,
            type : "GET",
            data : "currentPage=" + num + "&pageSize=" + ps ,
            contentType : "application/json;charset=utf-8",
            success : function(msg) {
                initTable(msg);
                if("[ROLE_USER]"==authority){
                    // $('.editDepa').attr("disabled", true);
                    // $('.delDepa').attr("disabled", true);
                    //$("#paging").attr("style","display:none;");
                }

                var i=1;
                var sqlData;
                var dateR;
                //表格用的日期格式

            },
            error : function(e) {
                console.log(e)
                alert("失败");
            }
        });
    }
    //初始化表格
    function initTable(data) {
        var obj = data.extend.data.list;
        var page = data.extend.data;
        page.pageNumber=page.pageNUm;
        myTable = $
            .lTable(
                '#tableList',
                {
                    data : obj
                    ,
                    title : [

                        "userId",
                        "date",
                        "zc",
                        "cd",
                        "zt",
                        "kg",
                        "qj",
                        "cc",
                    ] ,
                    name : [ "员工编号", "月份", "正常","迟到","早退","旷工","请假","出差" ],

                });

        $.lPaging('#paging',
            {
                pageNumber : page.pageNum
                ,
                totalPage : page.pages
                ,
                countSize : 8
                ,
                count : page.total
                ,
                inputSearch : false
                ,
                onPageChange : function(num) {
                    initPage(num, pageSize, dataUrl);
                }
            });
    }
</script>
</body>
